password = input()
def limit_1(password):
    if len(password) >= 8:
        return True
    else:
        return False

def limit_2(password):
    if password.isalnum():
        return True
    else:
        return False

def limit_3(password):
    hasupper = False
    hasdigit = False
    for i in password:
        if i.isalpha():
            if i.isupper():
                hasupper = True
        if i.isdigit():
            hasdigit = True
    if hasupper and hasdigit:
        return True
    else:
        return False

if limit_1(password) and limit_2(password) and limit_3(password):
    print(0)
else:
    if not limit_1(password):
        print(1)
    if not limit_2(password):
        print(2)
    if not limit_3(password):
        print(3)
                